## Warning: package 'dplyr' was built under R version 3.6.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Warning: package 'leaflet' was built under R version 3.6.2
## Warning: package 'rgdal' was built under R version 3.6.2
## Loading required package: sp
## Warning: package 'sp' was built under R version 3.6.2
## rgdal: version: 1.4-8, (SVN revision 845)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
##  Path to GDAL shared files: C:/Users/BlackHorror/Documents/R/win-library/3.6/rgdal/gdal
##  GDAL binary built with GEOS: TRUE 
##  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
##  Path to PROJ.4 shared files: C:/Users/BlackHorror/Documents/R/win-library/3.6/rgdal/proj
##  Linking to sp version: 1.3-2
## Warning: package 'tigris' was built under R version 3.6.2
## To enable 
## caching of data, set `options(tigris_use_cache = TRUE)` in your R script or .Rprofile.
## 
## Attaching package: 'tigris'
## The following object is masked from 'package:graphics':
## 
##     plot
## Warning: package 'readr' was built under R version 3.6.2

Тут реализация библиотеки leaflet для пометки маркером.

leaflet() %>%
  addTiles() %>%
  addMarkers(lng = c(91.442380, 37.564741),
             lat = c(53.721190, 55.751346),
             popup = c("Абакан", "Москва"))

Следующая реализация осуществляет фильтрацию популяции регионов США. Данные взяты с интернета в формате csv.

county_counts <- read_csv('C:/Users/BlackHorror/Desktop/leaflet_examples-master/leaflet_demo_R/data/population.csv')
## Parsed with column specification:
## cols(
##   NAME = col_character(),
##   total_pop = col_double(),
##   Male = col_double(),
##   Female = col_double()
## )
downloaddir<-getwd()
unzip('C:/Users/BlackHorror/Desktop/leaflet_examples-master/leaflet_demo_R/data/PA_Counties_clip.shp.zip', exdir=downloaddir, junkpaths=TRUE)

filename<-list.files(downloaddir, pattern=".shp", full.names=FALSE)
filename<-gsub(".shp", "", filename[1])

county_shapes<-readOGR(downloaddir, filename) 
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\BlackHorror\Desktop\leaflet_examples-master\leaflet_demo_R", layer: "PA_Counties_clip"
## with 67 features
## It has 13 fields
pal <- colorNumeric(
  palette = "YlGn",
  domain = county_counts$total_pop
)

county_shapes <- geo_join(county_shapes, county_counts, by_sp="NAME" , by_df="NAME" )


# создание карты 
paHealth.map <- leaflet() %>%
  addProviderTiles('CartoDB.Positron') %>%
  setView(lng=-77.16048, lat=41.00000, zoom =7) %>%
  addPolygons(data = county_shapes,
              stroke = T, smoothFactor = 0.2, fillOpacity = 0.5,
              color = "#000000", weight = 2, 
              fillColor = ~pal(county_shapes$total_pop)
              # color = ~pal(states@data$DISTRICT_)
  )%>% 
  addLegend("bottomright", pal = pal, values = county_counts$total_pop,
            title = "County Population",
            opacity = 1
  )